package com.ny.demo518;

import java.util.*;

public class TestMap {
    public void addEmp(Map<String, Emp> map, Emp emp) {
        map.put(emp.getNumber(), emp);
    }
    public Emp findAllEmpName(Map<String, Emp> map, String name) {
        for(Emp emp : map.values()) {
            if(emp.getName().equals(name)) {
                return emp;
            }
        }
        return null;
    }
    public void deleteEmp(Map<String, Emp> map, String number) {
        map.remove(number);
    }
    public Emp findAllEmpNumber(Map<String, Emp> map, String number) {
        return map.get(number);
    }
    public void updateEmp(Map<String, Emp> map, String number, Emp emp) {
        map.put(number, emp);
    }
}